package com.css.zfzx.sjcj.modules.drill.controller;

import com.css.bpm.platform.base.response.RestResponse;
import com.css.zfzx.sjcj.modules.drill.service.MutipleSheetExcelPoiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * @Description
 * @Author zyc
 * @Date 2021/1/15 17:12
 * @Version V1.0
 */
@RestController
@RequestMapping("/qh/drill")

public class MutipleSheetPoiController {
    @Autowired
    MutipleSheetExcelPoiService mutipleSheetExcelPoiService;

    /**
     * 导入多sheet Excel文件
     */
    @PostMapping("/importMultiSheet")
    public RestResponse importMultiSheetExcel(@RequestParam("file") MultipartFile excelFile) {
        return mutipleSheetExcelPoiService.importMultiSheetExcel(excelFile);
    }


    /**
     * 导出多sheet Excel文件
     */
    @GetMapping("/exportMultiSheet/{ids}")
    public RestResponse exportMultiSheetExcel(HttpServletResponse response, @PathVariable List<String> ids) {
        return mutipleSheetExcelPoiService.multipleSheetZipExports(response, ids);
    }
}
